package ssm.integration.controller;

import lombok.extern.slf4j.Slf4j;
import ssm.integration.pojo.Employee;
import ssm.integration.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * description: 表述层
 *
 * 1. @RestController = @ResponseBody + @Controller
 * 2. @RequestMapping("") 定义拦截路径
 * 3. @GetMapping("") 指定拦截路径和访问方式
 * 4. @Autowired 调用业务层接口
 * 5. 执行业务层方法
 */

@Slf4j
@RestController
@RequestMapping("emp")
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @GetMapping("find")
    public List<Employee> find(){
        List<Employee> all = employeeService.findAll();
        return all;
    }
}
